﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Serietheque.Fenetres
{
    /// <summary>
    /// Logique d'interaction pour AddSerie.xaml
    /// </summary>
    public partial class AddSerie : Window
    {
        private Series newSerie;

        public AddSerie()
        {
            InitializeComponent();
        }

        public AddSerie(Series newSerie)
        {
            // TODO: Complete member initialization

            InitializeComponent();
            this.newSerie = newSerie;
            //this.DataContext = this.newSerie;
            // mainGrid
        }

        private void SearchTvdb_Click(object sender, RoutedEventArgs e)
        {
            if (newSerie.Name != null)
            {
                Tvdb tvdb = new Tvdb();

                //newSerie.IdTvdb = tvdb.SerieIdByTvdb(newSerie.Name);
                newSerie.IdTvdb = tvdb.GetSerieId(newSerie.Name);

                if (true)
                {
                    tvdb.UpdateSerieData(newSerie);
                }
                mainGrid.DataContext = this.newSerie;
            }
        }

        private void FermerBtn_Click(object sender, RoutedEventArgs e)
        {

        }

        private void OkBtn_Click(object sender, RoutedEventArgs e)
        {

        }
    }
}
